package org.zk.dubbo_provider.service.impl;



import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.zk.dubbo_provider.dao.TeacherBillMapper;
import org.zk.entity.TeacherBill;
import org.zk.entity.Type;
import org.zk.service.TeacherBillService;
import com.alibaba.dubbo.config.annotation.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Alicelonely
 * @since 2019-12-11
 */
@Service(timeout = 10000)
public class TeacherBillServiceImpl implements TeacherBillService {
    @Resource
    private TeacherBillMapper teacherBillMapper;

    public TeacherBillMapper getTeacherBillMapper() {
        return teacherBillMapper;
    }

    public void setTeacherBillMapper(TeacherBillMapper teacherBillMapper) {
        this.teacherBillMapper = teacherBillMapper;
    }

     //教师个人中心零钱明细
    @Override
    public PageInfo<TeacherBill> getTeacherbillsPage(Map<String, Object> map) {
        PageInfo<TeacherBill> pageInfo;
        int pageSize=Integer.parseInt(String.valueOf(map.get("pageSize")));
        int pageNum=Integer.parseInt(String.valueOf(map.get("pageNum")));
        PageHelper.startPage(pageNum,pageSize);
        try {
            List<TeacherBill> list=teacherBillMapper.getTeacherbillPage(map);
            pageInfo = new PageInfo<>(list,pageSize);
        }finally {
            PageHelper.clearPage(); //清理 ThreadLocal 存储的分页参数,保证线程安全
        }
        return pageInfo;
    }

    @Override
    public int delTeacherBill(int id) {
        return teacherBillMapper.delTeacherBill(id);
    }

    @Override
    public List<TeacherBill> getTeacherBill(int id) {
        return teacherBillMapper.getTeacherBill(id);
    }


}
